Skip to content

comm: unexpected "file is not in sorted order"#12280

Open
blixygetir wants to merge 2 commits into
uutils:mainfrom
blixygetir:comm-fix
Open

comm: unexpected "file is not in sorted order"#12280
blixygetir wants to merge 2 commits into
uutils:mainfrom
blixygetir:comm-fix

Conversation

@blixygetir
Copy link
Copy Markdown
Contributor

Fixes #12253

The output matches the GNU suite, displaying the error message conditionally on the basis of the checking mode.
I have made changes to the error detection and displaying logic, handles all the test cases as per GNU.

Copilot AI review requested due to automatic review settings May 13, 2026 19:03
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts comm’s sorted-order error reporting to match GNU behavior more closely, emitting file-level warnings only in explicit --check-order mode and deferring default-mode reporting to the end.

Changes:

  • Gate file-level “file N is not in sorted order” warnings behind --check-order.
  • Ensure out-of-order detection still records an error in default mode, even when warnings aren’t printed immediately.
  • Update end-of-run error reporting to conditionally emit file-level and general “input is not in sorted order” messages.
Comments suppressed due to low confidence (1)

src/uu/comm/src/comm.rs:332

  • These file-level error messages are hardcoded English strings, which bypasses the existing localization key (comm-error-file-not-sorted) used elsewhere and will regress non-English locales. Use the translation key with the appropriate file_num instead of embedding the full message text here.
                let _ = writeln!(stderr(), "comm: file 1 is not in sorted order");
            }
            if checker2.has_error {
                let _ = writeln!(stderr(), "comm: file 2 is not in sorted order");
            }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/uu/comm/src/comm.rs
@@ -315,8 +321,15 @@ fn comm(
.map_err_context(|| translate!("comm-error-write"))?;

if should_check_order && (checker1.has_error || checker2.has_error) {
Comment thread src/uu/comm/src/comm.rs
Comment on lines +116 to +127
// Print file-level warnings only if --check-order was explicitly passed
// (in default mode, these are printed later in the final error reporting)
if !is_ordered && !self.has_error && self.check_order {
let _ = writeln!(
stderr(),
"{}",
translate!("comm-error-file-not-sorted", "file_num" => self.file_num.as_str())
);
}

// Always mark that we have an error, regardless of check_order flag
if !is_ordered && !self.has_error {
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 13, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)
Note: The gnu test tests/tail/pipe-f is now being skipped but was previously passing.
Congrats! The gnu test tests/printf/printf-surprise is now passing!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread src/uu/comm/src/comm.rs
Comment on lines +328 to +331
let _ = writeln!(stderr(), "comm: file 1 is not in sorted order");
}
if checker2.has_error {
let _ = writeln!(stderr(), "comm: file 2 is not in sorted order");
@blixygetir blixygetir closed this May 13, 2026
@blixygetir blixygetir reopened this May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

comm: unexpected "file is not in sorted order"

2 participants